Add Valve-220 map format support to quemap.#831
Conversation
Auto-detects Valve-220 by peeking for '[' after the texture name; falls back to standard Q3 format if not present. Both formats are supported transparently with no flags required. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds transparent support for Valve-220 (“explicit texture axes”) brush-side texture mapping in quemap, auto-detecting Valve-220 syntax in .map files and adjusting texture vector generation accordingly to improve face alignment (e.g., in cavern).
Changes:
- Detect Valve-220 brush-side syntax during map parsing by peeking for
[after the texture name. - Add a
brush_side_t::valveflag and generate texture vectors differently when Valve-220 axes are present. - Print a simple “Map format” note during
qbspcompilation based on whether any Valve-220 sides were detected.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/quemap/map.c | Adds Valve-220 vs standard format detection and parsing for brush-side texture parameters. |
| src/quemap/map.h | Extends brush_side_t with a valve flag indicating Valve-220 axis usage. |
| src/quemap/texture.c | Adds Valve-220-specific texture vector handling using explicit axes. |
| src/quemap/qbsp.c | Prints the detected map format after loading the map. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
This is great! But before we can merge it, we need to think this through. What are the implications to the editor? Does it need to be able to write v220 .map? Does it actually Just Work because it uses raw string copies of the brushes to begin with? Should we create a script that just converts all of our .maps to v220, if it's a superior format? Do we need to adjust our TrenchBroom config to tell it that we support / prefer v220? |
|
|
I think you've actually got this one. You should go for it. I would generate the script, version it in Quetoo's map-fu folder maybe? Or add it to map-fu itself? Then convert and rebake all .maps. And update the TrenchBroom and Radiant configs. I'll open a PR against TB proper for you once this is all working and merged. You got this! 💪🏻😎 |
Detect Valve-220 brush sides by peeking for '[' after the texture name,
parse the explicit S/T texture axes into side->axis, and compute texture
vectors directly from those axes in TextureVectorsForBrushSide. Falls back
to standard Q1/Q3 shift/rotate/scale parsing otherwise. quemap reports the
detected format ("Quake3 (Valve)" vs "Quake3").
Re-homed onto current main; supersedes the stale
feature/valve220-map-format branch (fork point f708ff0).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…an/quetoo into feature/valve220-map-format
BSP tree and portal generation recurse to the depth of the BSP tree (BuildTree_r, MakeTreePortals_r). On large maps the tree is deep enough to overflow the default 1 MB Windows main-thread stack, crashing quemap with an access violation in the portal pass (e.g. cavern.map). Linux and macOS give the main thread ~8 MB by default, so this only affected the Windows build. Set /STACK reserve to 8 MB to match. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jdolan
left a comment
There was a problem hiding this comment.
Almost there! We'll need a second PR in quetoo-data that updates scripts/map-fu to convert legacy to v220 as part of its preprocessing step. This will ensure that the Makefile in quetoo-data continues to function while also seamlessly updating the .map files.
| <!-- BSP tree/portal generation recurses to tree depth; the default 1 MB Windows | ||
| main-thread stack overflows on large maps (e.g. cavern). Reserve 8 MB to match | ||
| the Linux/macOS main-thread default. --> | ||
| <StackReserveSize>8388608</StackReserveSize> |
| /** | ||
| * @brief True if this brush side uses Valve-220 explicit texture axes. | ||
| */ | ||
| bool valve; |
There was a problem hiding this comment.
I think this boolean probably belongs as a global, right? We'd never encounter a .map file that uses some Valve brushes and some legacy / standard brushes, right?
|
|
||
| LoadMapFile(map_name); | ||
|
|
||
| bool valve = false; |
There was a problem hiding this comment.
Yea, what probably makes sense here is to introduce
typedef enum {
MAP_QUAKE2,
MAP_VALVE_220
} map_format_t;And have LoadMapFile return the resolved format, which you can set a global to.
map_format = LoadMapFile(map_name);And then everywhere downstream can just check map_format
| break; | ||
| } | ||
| } | ||
| Com_Print("Map format: %s\n", valve ? "Quake3 (Valve)" : "Quake3"); |
| */ | ||
| void TextureVectorsForBrushSide(brush_side_t *side, const vec3_t origin) { | ||
|
|
||
| if (side->valve) { |
There was a problem hiding this comment.
if (map_format == MAP_VALVE_220) {- Added an error path to map format selection to -make sure- mixed format .map files don't get processed. Even though it should never happen. - also bumped the phone max face count because kept getting spam from quemap about my crystal clusters :|
jdolan
left a comment
There was a problem hiding this comment.
Woohoo! Some super minor feedback, feel free to address, or not. This is approved.
| <LocalDebuggerCommandArguments>-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp test</LocalDebuggerCommandArguments> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
| <LocalDebuggerCommandArgumentsHistory>-p "D:\quetoo_dev\github\quetoo\Quetoo.vs15\../../quetoo-data/src/default" -bsp -light tokays|-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp test|-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp longyard|-p "C:\Users\chrisg\OneDrive\Documents\My Games\Quetoo\default" -bsp maps/longyard|</LocalDebuggerCommandArgumentsHistory> |
There was a problem hiding this comment.
I'm guessing this whole file should be .gitignored? But I'm not going to lose sleep over it.
There was a problem hiding this comment.
if we can just gitnore that ONE section (well ALL sections with "LocalDebugger*", that would be awesome - that seems to change each commit 👎 . The rest is relevant.
| } | ||
|
|
||
| #define MAX_VERTEX_FACES 32 | ||
| #define MAX_VERTEX_FACES 64 |
| * @return The resolved map format, also stored in the global `map_format`. | ||
| */ | ||
| void LoadMapFile(const char *filename) { | ||
| int LoadMapFile(const char *filename) { |
There was a problem hiding this comment.
uber-nit: should return the enum type here.
- @jdolan 's Nitpick is correct.


Auto-detects Valve-220 by peeking for '[' after the texture name; falls back to standard Q3 format if not present. Both formats are supported transparently with no flags required.
Ran into issues aligning faces in
cavern- this helps. TB support for patch editing is coming too, which will also help alot.